//=============================================================================
//// Shader uses position and texture
//=============================================================================
cbuffer cbPerObject{
	matrix mtxWorldVP : WorldViewProjection;
};

SamplerState samLinear
{
    Filter = MIN_MAG_MIP_LINEAR;
    AddressU = Mirror;
    AddressV = Mirror;
};
Texture2D gDiffuseMap : DiffuseMap;


struct VS_INPUT{
	float3 Pos : POSITION;
	float3 Norm : NORMAL;
    float2 Tex : TEXCOORD0;
};
struct VS_OUTPUT{
	float4 oPosH : SV_POSITION;
	float2 oTex : TEXCOORD0;
};
//--------------------------------------------------------------------------------------
// Vertex Shader
//--------------------------------------------------------------------------------------
VS_OUTPUT VS( VS_INPUT input )
{
	VS_OUTPUT output = (VS_OUTPUT)0;
	output.oPosH = mul( float4(input.Pos,1), mtxWorldVP );
	output.oTex = input.Tex;

	return output;
}
//--------------------------------------------------------------------------------------
// Pixel XMeshShader
//--------------------------------------------------------------------------------------
struct PS_INPUT{
	float4 posH : SV_POSITION;
	float2 tex : TEXCOORD0;
};

struct PS_OUTPUT{
	float4 color0 : SV_TARGET;
};

float4 PS( PS_INPUT input): SV_Target
{
	return gDiffuseMap.Sample( samLinear, input.tex ) ;
	//return float4(1,1,1,1);
}


technique10 Render
{
    pass P0
    {          
        SetVertexShader( CompileShader( vs_4_0, VS() ) );
        SetGeometryShader( NULL );
        SetPixelShader( CompileShader( ps_4_0, PS() ) );
    }
}

